#pragma once
#ifndef SDEF_MISSIONSCENE
#define SDEF_MISSIONSCENE

#include <SypX/SypX.h>
#include "Scene.h"

namespace SheepDefence
{
	struct mission
	{
		SypX::Texture* tex;
		SypX::Button* go;
		float x, y;
		bool enabled;
		int scores[3], grades[3];
		SypX::MeshInstance* icons[3], * stars[3];
	};

	class MissionScene : public Scene
	{
	public:
		MissionScene(SypX::Font* f, int level, int breed = 0, int score = 0, int stars = 0);
		~MissionScene(void);
		virtual void init();
		virtual void run();
		virtual void handleInput();
	private:		
		SypX::Renderer* render;
		SypX::Engine* engine;
		SypX::Canvas* canvas;

		SypX::Mesh* bgMesh, * starMesh, * dogMesh;
		SypX::Texture* bgTex, * backTex;
		std::vector<SypX::Texture*> stars;
		std::vector<SypX::Texture*> dogs;

		SypX::MeshInstance* bg;
		SypX::SoundBuffer* snd;
		SypX::Font* font;

		SypX::Button* back;
		std::vector<mission> missions;

		int page, level;

		int loadProfile();
		void draw(float time);
		bool mousedown;
		float anchor_x, curr_x;
		int updateBreed;
		int updateScore, updateGrade;

		void goBack(SypX::GuiComponent* g, SypX::Event& e);
		void goPlay(SypX::GuiComponent* g, SypX::Event& e);
	};
}
#endif